package hmvictor.jpql.renderers;

import hmvictor.jpql.types.ParameterType;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;

/**
 *
 * @author Victor
 */
public class ParameterTypeRenderer extends DefaultListCellRenderer{
    
    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 
        if(value != null) {
            component.setText(((ParameterType)value).getName());
        }
        return component; 
    }
    
}
